#include "uart.h"
#include <stdint.h>
#define UART0     0x10000000UL
#define UART_THR  (UART0 + 0x0)
#define UART_LSR (UART0 + 0x5)
#define LSR_THRE  0x20

void uart_putc(char c){
	volatile unsigned char *lsr = (volatile unsigned char *)UART_LSR;
	volatile unsigned char *thr = (volatile unsigned char *)UART_THR;
	while(!(*lsr & LSR_THRE)){}
	*thr = (unsigned char)c;
}

void uart_puts(const char *s){
	while(*s){
		if(*s == '\n') uart_putc('\r');
		uart_putc(*s++);
	}
}
